package org.jeecg.enums.car;

/**
 * 车场进出记录 车牌类型
 *  0 蓝牌 1 黑牌 2 黄牌 3 新黄牌 4 黄色后牌 5 警车 6 军车 7 新黄色后 8武警 9新白牌
 */
public enum CarPlateColorEnum {
    CAR_NO_COLOR_0(0, "蓝牌"),
    CAR_NO_COLOR_1(1, "黑牌"),
    CAR_NO_COLOR_2(2, "黄牌"),
    CAR_NO_COLOR_3(3,"新黄牌"),
    CAR_NO_COLOR_4(4,"黄色后牌"),
    CAR_NO_COLOR_5(5,"警车"),
    CAR_NO_COLOR_6(6,"军车"),
    CAR_NO_COLOR_7(7,"新黄色后"),
    CAR_NO_COLOR_8(8,"武警"),
    CAR_NO_COLOR_9(9,"新白牌"),
    ;

    private Integer code;
    private String desc;

    CarPlateColorEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(Integer value) {
        if (value == null) return "";
        CarPlateColorEnum[] enums = values();
        for (CarPlateColorEnum typeEnum : enums) {
            if (value.intValue()  == typeEnum.getCode().intValue()) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static Integer getValue(String desc) {
        CarPlateColorEnum[] enums = values();
        for (CarPlateColorEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }

}
